'''

'''
class HuMen:
    def __init__(self, name, age):
        print('humen init')
        self.name = name
        self.age = age

    def show(self):
        print('name:%s,age:%s' % (self.name, self.age))

    @classmethod
    def from_name(cls, name):
        return cls(name, 0)

    @classmethod
    def from_dict(cls, data):
        return cls(data['name'], data['age'])

# 使用不同的构造方式创建对象
hm1 = HuMen('yejing', 22)
hm2 = HuMen.from_name('yejing')
hm3 = HuMen.from_dict({'name': 'yejing', 'age': 22})

hm1.show()
hm2.show()
hm3.show()
